Function: c-backward-to-nth-BOF-{
c-backward-to-nth-BOF-{ is a byte-compiled function defined in
cc-cmds.el.gz.
Signature
(c-backward-to-nth-BOF-{ N WHERE)
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cc-cmds.el.gz
(defun c-backward-to-nth-BOF-{ (n where)
;; Skip to the opening brace of the Nth function before point. If
;; point is inside a function, this counts as the first. Point must be
;; outside any comment/string or macro.
;;
;; N must be strictly positive.
;; WHERE describes the position of point, one of the symbols `at-header',
;; `in-header', `in-block', `in-trailer', `at-function-end',
;; `outwith-function' as returned by c-where-wrt-brace-construct.
;;
;; If we run out of functions, leave point at BOB. Return zero on success,
;; otherwise the number of {s still to go.
;;
;; This function may do hidden buffer changes
(cond
;; What we do to go back the first defun depends on where we start.
((bobp))
((eq where 'in-block)
(goto-char (c-least-enclosing-brace (c-parse-state)))
(setq n (1- n)))
((eq where 'in-header)
(let ((encl-paren (c-least-enclosing-brace (c-parse-state))))
(if encl-paren (goto-char encl-paren))
(c-syntactic-re-search-forward "{" nil t t)
(backward-char)
(setq n (1- n))))
((memq where '(at-header outwith-function at-function-end in-trailer))
(c-syntactic-skip-backward "^}")
(when (eq (char-before) ?\})
(backward-sexp)
(setq n (1- n))))
(t (error "Unknown `where' %s in c-backward-to-nth-EOF-{" where)))
;; Each time round the loop, go back to a "{" at the outermost level.
(while (and (> n 0) (not (bobp)))
(c-parse-state) ; This call speeds up the following one
; by a factor of ~6. Hmmm. 2006/4/5.
(c-syntactic-skip-backward "^}")
(when (eq (char-before) ?\})
(backward-sexp)
(setq n (1- n))))
n)